package com.bizmerce.rnd.oms.reporting.web;
import java.awt.Color;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.view.document.AbstractPdfView;

import com.lowagie.text.Cell;
import com.lowagie.text.Document;
import com.lowagie.text.Element;
import com.lowagie.text.Font;
import com.lowagie.text.Paragraph;
import com.lowagie.text.Table;
import com.lowagie.text.pdf.BaseFont;
import com.lowagie.text.pdf.PdfWriter;

public class Form17 extends AbstractPdfView{

	@Override
	protected void buildPdfDocument(Map map, Document document, PdfWriter writer,
			HttpServletRequest request, HttpServletResponse response) throws Exception {
		/**FONTS*/
		BaseFont baseFont = BaseFont.createFont("HYGoThic-Medium", "UniKS-UCS2-H", BaseFont.NOT_EMBEDDED);
		Font headerFont = new Font(baseFont, 14, Font.BOLD, Color.black);
		Font textFont = new Font(baseFont, 8, Font.NORMAL, Color.black);
		Font underlineFont = new Font(baseFont, 20, Font.UNDERLINE);
		
		/**TITLE*/
		Paragraph paragraph;
		paragraph = new Paragraph("<양식 17>원산지증명서 발급대장(FTA 특례법)", headerFont);
		document.add(paragraph);
		
		paragraph = new Paragraph("원산지증명서 작성대장", underlineFont);
		paragraph.setAlignment(Element.ALIGN_CENTER);
		document.add(paragraph);

		/**TABEL INFORMATION*/
		Table table;
		Cell cell;
		table = new Table(11);
		table.setWidth(100);
		table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
		table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
		int headerwidths[] = { 8, 10, 12, 12, 8, 6, 8, 8, 10, 12, 6};
		table.setWidths(headerwidths);
		table.setPadding(2);
		cell = new Cell(new Paragraph("발급"+"\n"+"번호",textFont));
		table.addCell(cell);
		cell = new Cell(new Paragraph("발급"+"\n"+"일자 ",textFont));
		table.addCell(cell);
		cell = new Cell(new Paragraph("수출신고번호"+"\n"+"및 수리일자",textFont));
		table.addCell(cell);
		cell = new Cell(new Paragraph("품명-규격",textFont));
		table.addCell(cell);
		cell = new Cell(new Paragraph("품목"+"\n"+"번호",textFont));
		table.addCell(cell);
		cell = new Cell(new Paragraph("수량",textFont));
		table.addCell(cell);
		cell = new Cell(new Paragraph("원산지",textFont));
		table.addCell(cell);
		cell = new Cell(new Paragraph("생산자"+"\n"+"(공급자)",textFont));
		table.addCell(cell);
		cell = new Cell(new Paragraph("수입자 및"+"\n"+"수입국명",textFont));
		table.addCell(cell);
		cell = new Cell(new Paragraph("협정명칭 및"+"\n"+"원산지 결정기준",textFont));
		table.addCell(cell);
		cell = new Cell(new Paragraph("비고",textFont));
		table.addCell(cell);
		
		for(int i=0;i<=20;i++){
			cell = new Cell(new Paragraph("47260-00141 ",textFont));
			table.addCell(cell);
			cell = new Cell(new Paragraph("2010.08.20",textFont));
			table.addCell(cell);
			cell = new Cell(new Paragraph("2010.08.20",textFont));
			table.addCell(cell);
			cell = new Cell(new Paragraph("ZKSC0240/"+"\n"+"STEELCASE ",textFont));
			table.addCell(cell);
			cell = new Cell(new Paragraph("7326909000",textFont));
			table.addCell(cell);
			cell = new Cell(new Paragraph("1000",textFont));
			table.addCell(cell);
			cell = new Cell(new Paragraph("한-ASEAN",textFont));
			table.addCell(cell);
			cell = new Cell(new Paragraph("한-ASEAN",textFont));
			table.addCell(cell);
			cell = new Cell(new Paragraph("한-ASEAN",textFont));
			table.addCell(cell);
			cell = new Cell(new Paragraph("한-ASEAN/"+"\n"+"CC+BD 21%",textFont));
			table.addCell(cell);
			cell = new Cell(new Paragraph("비고",textFont));
			table.addCell(cell);
		}
		document.add(table);
	}
}
